import http from './request.js';

// 获取用户详情
export const userDetail = (params) => {
  return http.get('/user_detail', params).then((res) => res.data);
};

// 保存个人信息
export const perfectInfo = (params) => {
  return http.post('/perfect_info', params).then((res) => res.data);
};

// 创意风格
export const getStyle = (params) => {
  return http.get('/get_style', params).then((res) => res.data);
};
// 创意列表
export const getOriginalityList = (params) => {
  return http
    .get('/get_originality_list', { params: params })
    .then((res) => res.data);
};
// 创意详情
export const getOriginalityDetail = (params) => {
  return http
    .get(`/get_originality_detail`, { params: params })
    .then((res) => res.data);
};
// 创意借鉴
export const addReference = (params) => {
  return http.post(`/add_reference`, params).then((res) => res.data);
};
// 取消创意借鉴
export const deleteReference = (params) => {
  return http.post(`/delete_reference`, params).then((res) => res.data);
};
// 商场分类
export const getCategory = (params) => {
  return http.get(`/get_category`, params).then((res) => res.data);
};

// 商品列表
export const getProductList = (params) => {
  return http.get(`/get_product_list`, { params }).then((res) => res.data);
};

// 商品详情
export const getProductDetail = (params) => {
  return http.get(`/get_product_detail`, { params }).then((res) => res.data);
};

// 加入购物车
export const addCart = (params) => {
  return http.post(`/add_cart`, params).then((res) => res.data);
};

// 创建订单
export const createOrder = (params) => {
  return http.post(`/create_order`, params).then((res) => res.data);
};

// 我的积分
export const myScore = (params) => {
  return http.get(`/my_score`, { params }).then((res) => res.data);
};

// 积分规则
export const getScoreRule = (params) => {
  return http.get(`/get_score_rule`, { params }).then((res) => res.data);
};

// 优惠券
export const myCoupon = (params) => {
  return http.get(`/my_coupon`, { params }).then((res) => res.data);
};

// 领取优惠券
export const receiveCoupon = (params) => {
  return http.post(`/receive_coupon`, params).then((res) => res.data);
};

// 获取地址列表
export const getAddressList = (params) => {
  return http.get(`/get_address_list`, { params }).then((res) => res.data);
};

// 获取地址详情
export const getAddressDetail = (params) => {
  return http.get(`/get_address_detail`, { params }).then((res) => res.data);
};

// 添加修改用户地址
export const addEditAddress = (params) => {
  return http.post(`/add_edit_address`, params).then((res) => res.data);
};

// 设置默认地址
export const addressDefaultSet = (params) => {
  return http.post(`/address_default_set`, params).then((res) => res.data);
};

// 删除地址
export const addressDel = (params) => {
  return http.post(`/address_del`, params).then((res) => res.data);
};

// 获取默认地址
export const getAddressDefault = (params) => {
  return http.get(`/get_address_default`, { params }).then((res) => res.data);
};

// 获取运费
export const getFreighttemplate = (params) => {
  return http.get(`/get_freighttemplate`, { params }).then((res) => res.data);
};

// 获取支付信息
export const payOrder = (params) => {
  return http.post(`/pay_order`, params).then((res) => res.data);
};

// 我的订单列表
export const myOrderList = (params) => {
  return http.post(`/my_order_list`, params).then((res) => res.data);
};

// 订单详情
export const orderDetail = (params) => {
  return http.post(`/order_detail`, params).then((res) => res.data);
};

// 确认收货
export const confirmOrder = (params) => {
  return http.post(`/confirm_order`, params).then((res) => res.data);
};

// 获取物流信息
export const queryExpress = (params) => {
  return http.get(`/query_express`, { params }).then((res) => res.data);
};

// 我的购物车
export const myCartList = (params) => {
  return http.get(`/my_cart_list`, { params }).then((res) => res.data);
};

// 申请退款
export const applyRefund = (params) => {
  return http.post(`/apply_refund`, params).then((res) => res.data);
};

// 取消申请
export const withdraw = (params) => {
  return http.post(`/withdraw`, params).then((res) => res.data);
};

// 退款详情
export const refundDetail = (params) => {
  return http.get(`/refund_detail`, { params }).then((res) => res.data);
};

// 填写退货单
export const fillLogistics = (params) => {
  return http.post(`/fill_logistics`, params).then((res) => res.data);
};

// 移除购物车
export const delCart = (params) => {
  return http.post(`/del_cart`, params).then((res) => res.data);
};

// 我的收藏
export const myCollect = (params) => {
  return http.get(`/my_collect`, { params }).then((res) => res.data);
};

// 获取基础信息
export const getConfiguration = (params) => {
  return http.get(`/get_configuration`, { params }).then((res) => res.data);
};

// 我的设计
export const myDiy = (params) => {
  return http.get(`/my_diy`, { params }).then((res) => res.data);
};

// 获取用户今日是否弹出弹窗
export const getUserPop = (params) => {
  return http.get(`/get_user_pop`, { params }).then((res) => res.data);
};

// 删除diy
export const deleteDiy = (params) => {
  return http.post(`/delete_diy`, params).then((res) => res.data);
};

// 分享
export const userShare = (params) => {
  return http.post(`/user_share`, params).then((res) => res.data);
};
// 退出登录
export const logout = (params) => {
  return http.post(`/log_out`, params).then((res) => res.data);
};
// 珠子排序详情
export const getDiyProductInfo = (params) => {
  return http.get(`/get_diy_product_info`, { params }).then((res) => res.data);
};
// 积分扣除
export const diyDeductingPoints = (params) => {
  return http.post(`/diy_deducting_points`,  params).then((res) => res.data);
};
//  dIY订单和商城页的固定信息
export const getBaseInfo = (params) => {
  return http.post(`/get_base_info`,  params).then((res) => res.data);
};